package com.example.dao;

import com.example.entity.Orders;
import com.example.entity.Users;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface OrdersDao {
    @Select("select * from orders")
    ArrayList<Orders> queryAll();

    @Delete("delete from orders where oID = #{id}")
    int deleteById(Integer id);

    @Select("select * from orders where oID = #{id}")
    int selectByID(Integer id);

    @Select("select * from orders where oID = #{id}")
    Orders findById(Integer id);

    @Update("UPDATE orders SET " +
            "uID = #{orders.uid}," +
            "oTime = #{orders.otime}," +
            "oTotal = #{orders.ototal}" +
            "WHERE oID = #{orders.oid}")
    int update(@Param("orders")Orders orders);

    @Insert("insert into orders(uId,oTime,oTotal)" +
            "values(#{orders.uid}," +
            "#{orders.otime}," +
            "#{orders.ototal})")
    int insert(@Param("orders")Orders orders);
}
